using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class site : System.Web.UI.MasterPage
{
	protected void Page_Load(object sender, EventArgs e)
	{
	}

	protected string GetColoredHeading(string title)
	{
		// If you want the title to be half white/half blue, 
		// use GetHalfColoredHeading
		//return GetHalfColoredHeading(title);

		// Otherwise, if you want the title to have
		// words alternating white/blue, use GetAltColoredHeading
		return GetAltColoredHeading(title);
	}

	/// <summary>
	/// Add's a &lt;span&gt; tag around the second half of the title.
	/// </summary>
	/// <param name="title">String to convert.</param>
	/// <returns>Converted string.</returns>
	protected string GetHalfColoredHeading(string title)
	{
		string[] splitTitle;
		splitTitle = title.Split(' ');

		if (splitTitle.Length == 1)
			return title;
		else
		{
			int nHalf = splitTitle.Length / 2;
			string result = String.Join("", splitTitle, 0, nHalf);

			result += "<span>";

			result += String.Join("", splitTitle, nHalf, splitTitle.Length - nHalf);

			result += "</span>";

			return result;
		}
	}

	/// <summary>
	/// Adds a &lt;span&gt; tag around every second word.
	/// </summary>
	/// <param name="title">String to convert.</param>
	/// <returns>Converted string.</returns>
	protected string GetAltColoredHeading(string title)
	{
		string[] splitTitle;
		splitTitle = title.Split(' ');

		if (splitTitle.Length == 1)
			return title;
		else
		{
			string result = "";
			for (int i = 0; i < splitTitle.Length; i++)
			{
				if (i % 2 == 0)
					result += splitTitle[i];
				else
					result += "<span>" + splitTitle[i] + "</span>";
			}
			return result;
		}
	}

}
